package org.boot.chat.data.model.service;

import jakarta.annotation.Resource;
import org.boot.chat.data.model.dao.ChatModelRepository;
import org.boot.chat.data.model.entity.ChatModelDO;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ChatModelService {
    @Resource
    private ChatModelRepository chatModelRepository;

    public Long save(ChatModelDO e) {
        return chatModelRepository.insert(e);
    }

    public List<ChatModelDO> list(ChatModelDO chatModelDO) {
        return chatModelRepository.list(chatModelDO);
    }

    public Optional<ChatModelDO> one(Long id) {
        return chatModelRepository.findById(id);
    }

    public void update(ChatModelDO e) {
        chatModelRepository.update(e);
    }

    public void remove(String bean) {
        chatModelRepository.deleteByBean(bean);
    }
}
